Class Objects.Creature

A derivative of the Objects.Moveable class that represents the AI and behavior state of an enemy creature in the game.

Functions

Creature(moveable) Create creature info for the provided moveable.
GetMood() Gets the current mood of the creature.
SetMood(mood) Sets the mood of the creature.
GetTarget() Gets the current target of the creature.
SetTarget(mov) Sets a new target for the creature.
GetTargetPosition() Gets the current target position of the creature.
GetAlerted() Gets the creature's alerted state.
SetAlerted(enabled) Sets the creature's alerted state.
GetFriendly() Gets the creature's friendly state.
SetFriendly(enabled) Sets the creature's friendly state.
GetHurtByPlayer() Gets whether the creature has been hurt by the player.
SetHurtByPlayer(enabled) Sets whether the creature has been hurt by the player.
GetPoisoned() Gets the creature's poisoned state.
SetPoisoned(enabled) Sets the creature's poisoned state.
GetAtGoal() Gets whether the creature has reached its goal.
SetAtGoal(enabled) Sets whether the creature has reached its goal.
GetLocationAI() Get the OCB of the AI object that the enemy is currently trying to reach.
SetLocationAI(value) Updates the AI object OCB that the creature should try to reach.
GetJumping() Gets whether the creature's pathfinding currently involves a jump.
GetMonkeying() Gets whether the creature's pathfinding currently involves monkey-swinging.
GetValid() Checks if the underlying creature data is still valid.


Functions

Creature(moveable)
Create creature info for the provided moveable.

Parameters:

  • moveable Moveable Moveable object to fetch creature from. Must be an active enemy.

Returns:

    Creature Creature info for the moveable.
GetMood()
Gets the current mood of the creature.

Returns:

    MoodType The current mood of the creature. Never returns Objects.MoodType.AUTO, because underlying mood is always resolved to another value by the AI. If creature is invalid, returns nil.
SetMood(mood)
Sets the mood of the creature. Overrides the automatic mood management and forces the creature's mood to the specified value. Setting the mood to Objects.MoodType.AUTO will clear any mood override and allow the creature to automatically manage the mood according to the AI.

Parameters:

GetTarget()
Gets the current target of the creature.

Returns:

    Moveable The moveable object representing the target. If creature is invalid or target is not set, returns nil.
SetTarget(mov)
Sets a new target for the creature.

Parameters:

  • mov Moveable The moveable object to set as the target. Set to nil to clear the target.
GetTargetPosition()
Gets the current target position of the creature. Target position may differ from the actual enemy position if predictionFactor is set. If no enemy is currently set or mood is set to bored or stalk, returns the position where the creature is currently heading to.

Returns:

    Vec3 The position of the creature's target. If creature is invalid, returns nil.
GetAlerted()
Gets the creature's alerted state.

Returns:

    bool true if creature is alerted, false if not alerted. If creature is invalid, returns nil.
SetAlerted(enabled)
Sets the creature's alerted state.

Parameters:

  • enabled bool true sets creature as alerted, false clears the alert state.
GetFriendly()
Gets the creature's friendly state. If creature was attacked by player, friendly state alone is not enough to know whether a creature is violent. For such cases, Objects.Creature.GetHurtByPlayer must also be used in combination with this method.

Returns:

    bool true if the creature is marked as friendly, false if it is marked as not friendly. If creature is invalid, returns nil.
SetFriendly(enabled)
Sets the creature's friendly state. Friendly creatures will not attack the player unless player attacks them first, except special cases when behavior is hardcoded. If a friendly creature was attacked by player, Objects.Creature.SetHurtByPlayer must be set to false as well to stop them attacking player.

Parameters:

  • enabled bool true sets creature as friendly, false sets it as hostile.
GetHurtByPlayer()
Gets whether the creature has been hurt by the player.

Returns:

    bool true means that creature was hurt by player, false means it was not hurt by player. If creature is invalid, returns nil.
SetHurtByPlayer(enabled)
Sets whether the creature has been hurt by the player. This flag influences creature mood toward escape behavior.

Parameters:

  • enabled bool true marks the creature as hurt by player, false clears hurt state.
GetPoisoned()
Gets the creature's poisoned state.

Returns:

    bool true means the creature is poisoned, false means it's not poisoned. If creature is invalid, returns nil.
SetPoisoned(enabled)
Sets the creature's poisoned state. Poisoned creatures take periodic damage and may be slowly killed, if killPoisonedEnemies setting is on.

Parameters:

  • enabled bool true sets creature as poisoned, false clears poisoned state.
GetAtGoal()
Gets whether the creature has reached its goal. This setting may be used to find out whether a creature that is using AI nullmesh objects has reached its currently specified AI nullmesh.

Returns:

    bool true means the creature has reached the goal, false means it's not at goal. If creature is invalid, returns nil.
SetAtGoal(enabled)
Sets whether the creature has reached its goal. This setting may be used to break out the creature from reaching the next specified AI object nullmesh.

Parameters:

  • enabled bool true marks the creature as having reached the goal, false clears goal reached state.
GetLocationAI()

Get the OCB of the AI object that the enemy is currently trying to reach. Used by specific enemies for custom waypoint logic:

Returns:

    int The current AI location index. If creature is invalid, returns nil.
SetLocationAI(value)

Updates the AI object OCB that the creature should try to reach. Used by specific enemies for custom waypoint logic:

Parameters:

  • value int The AI location index to set.
GetJumping()
Gets whether the creature's pathfinding currently involves a jump. Only works for enemies that support jumping.

Returns:

    bool true if creature is jumping or about to jump, false if not jumping. If creature is invalid, returns nil.
GetMonkeying()
Gets whether the creature's pathfinding currently involves monkey-swinging.

Returns:

    bool true if creature is monkey-swinging, false if not. If creature is invalid, returns nil.
GetValid()
Checks if the underlying creature data is still valid. Returns false if the creature was killed or disabled.

Returns:

    bool true if creature data is valid, false if creature was killed or disabled.
generated by TEN-LDoc (a fork of LDoc 1.4.6)